import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 退膳登记记录信息 */
export interface ReportRefund {
          id: number; // 编号
          processInstanceId: string; // 实例ID
          schoolCode?: string; // 园区
          refundStartTime: string | Dayjs; // 退费开始时间
          refundEndTime: string | Dayjs; // 退费结束时间
          gradeId: number; // 年级ID
          gradeName: string; // 年级
          classId: number; // 班级ID
          className: string; // 班级
          fileUrls: string; // 登记文件
          sort?: number; // 排序
          status?: number; // 状态
  }

// 退膳登记记录 API
export const ReportRefundApi = {
  // 查询退膳登记记录分页
  getReportRefundPage: async (params: any) => {
    return await request.get({ url: `/school/report-refund/page`, params })
  },

  // 查询退膳登记记录详情
  getReportRefund: async (id: number) => {
    return await request.get({ url: `/school/report-refund/get?id=` + id })
  },

  // 新增退膳登记记录
  createReportRefund: async (data: ReportRefund) => {
    return await request.post({ url: `/school/report-refund/create`, data })
  },

  // 修改退膳登记记录
  updateReportRefund: async (data: ReportRefund) => {
    return await request.put({ url: `/school/report-refund/update`, data })
  },

  // 删除退膳登记记录
  deleteReportRefund: async (id: number) => {
    return await request.delete({ url: `/school/report-refund/delete?id=` + id })
  },

  /** 批量删除退膳登记记录 */
  deleteReportRefundList: async (ids: number[]) => {
    return await request.delete({ url: `/school/report-refund/delete-list?ids=${ids.join(',')}` })
  },

  // 导出退膳登记记录 Excel
  exportReportRefund: async (params) => {
    return await request.download({ url: `/school/report-refund/export-excel`, params })
  },
}